package top.igotcha.chapter.chapter2;

/**
 * @author Gotcha
 * @date 2021/2/27
 * @describe
 */
public class CreateThread02 {
    public static void main(String[] args) {
        //创建线程任务
        Runnable r = new Runnable(){
            @Override
            public void run() {
                System.out.println("Runnable running");
            }
        };
        //将Runnable对象传给Thread
        Thread t = new Thread(r);
        //启动线程
        t.start();

        //改成lambda表达式方式如下
        new Thread(() ->System.out.println("Runnable running")).start();
    }
}
